<?php

use Illuminate\Support\Facades\Schema;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;

class CreateAdminsTable extends Migration
{
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        Schema::create('admins', function (Blueprint $table) {
            $table->increments('id');
            $table->string('username', 50)->unique()->comment('用户名');
            $table->string('email', 100)->unique()->comment('邮箱');
            $table->string('password')->comment('密码');
            $table->string('avatar')->nullable()->comment('头像');
            $table->string('login_ip', 20)->default('127.0.0.1')->comment('登录ip');
            $table->integer('login_count')->default('0')->comment('登录次数');
            $table->string('nick_name', 20)->nullable()->comment('昵称');
            $table->string('chinese_name', 20)->nullable()->comment('真实姓名');
            $table->boolean('sex')->default('0')->comment('性别，1男，0女');

            $table->string('qq', 20)->nullable()->comment('qq');
            $table->string('phone', 20)->nullable()->comment('电话');

            $table->boolean('super_admin')->default('0')->comment('网站创始人,1是，0否');

            $table->boolean('status')->default('0')->index()->comment('状态1启用，0禁用');
            $table->integer('role_id')->default('0')->index()->comment('所属权限');

            $table->softDeletes();
            $table->timestamps();
        });
    }

    /**
     * Reverse the migrations.
     *
     * @return void
     */
    public function down()
    {
        Schema::dropIfExists('admins');
    }
}
